package com.jb.web.bean.custom;

import com.jb.faces.context.FacesContext;
import com.jb.framework.PersistentContext;
import com.jb.map.domain.Address;
import com.jb.web.application.HtmlConstants;
import com.jb.web.bean.HtmlItem;
import com.jb.web.bean.inspector.FilePropertyEditor;
import com.jb.web.bean.inspector.OptionPropertyEditor;
import com.jb.web.context.WebContext;

public class GeoMap extends HtmlItem implements Address {

    private void $init$() {
        state = "CA";
        city = "Redwood City";
        country = "US";
        latitude = -1D;
        longitude = -1D;
        hierarchicalTypeControl = false;
        mapControl = "GSmallMapControl";
        overviewControl = false;
        typeControl = true;
        scale = 10;
    }

    public void processDecodes(FacesContext ctx) {
        super.processDecodes(ctx);
        ((WebContext)ctx).includeScript(HtmlConstants.GEOMAP);
    }

    public void setDefault(PersistentContext pCtx) {
        super.setDefault(pCtx);
        setHeight("300px");
        setWidth("500px");
        setStyleClass("jbGeoMap");
    }

    public void setMapControl(String param) {
        mapControl = param;
    }

    public String getMapControl() {
        return mapControl;
    }

    public void setTypeControl(boolean param) {
        typeControl = param;
    }

    public boolean isTypeControl() {
        return typeControl;
    }

    public void setInfoWindow(String param) {
        infoWindow = param;
    }

    public String getInfoWindow() {
        return infoWindow;
    }

    public void setScale(int param) {
        scale = param;
    }

    public int getScale() {
        return scale;
    }

    public void setModel(String param) {
        model = param;
    }

    public String getModel() {
        return model;
    }

    public void setStreetLine1(String param) {
        streetLine1 = param;
    }

    public String getStreetLine1() {
        return streetLine1;
    }

    public void setStreetLine2(String param) {
        streetLine2 = param;
    }

    public String getStreetLine2() {
        return streetLine2;
    }

    public void setPostalCode(String param) {
        postalCode = param;
    }

    public String getPostalCode() {
        return postalCode;
    }

    public void setState(String param) {
        state = param;
    }

    public String getState() {
        return state;
    }

    public void setCity(String param) {
        city = param;
    }

    public String getCity() {
        return city;
    }

    public void setCountry(String param) {
        country = param;
    }

    public String getCountry() {
        return country;
    }

    public void setLatitude(double param) {
        latitude = param;
    }

    public double getLatitude() {
        return latitude;
    }

    public void setLongitude(double param) {
        longitude = param;
    }

    public double getLongitude() {
        return longitude;
    }

    public void setObject(Object param) {
        object = param;
    }

    public Object getObject() {
        return object;
    }

    public String toString() {
        StringBuffer str = new StringBuffer();
        if (streetLine1 != null)
            str.append(streetLine1).append(" ");
        if (city != null)
            str.append(city).append(" ");
        if (state != null)
            str.append(state);
        if (country != null)
            str.append(",").append(country);
        return str.toString();
    }

    public void setHierarchicalTypeControl(boolean param) {
        hierarchicalTypeControl = param;
    }

    public boolean isHierarchicalTypeControl() {
        return hierarchicalTypeControl;
    }

    public void setOverviewControl(boolean param) {
        overviewControl = param;
    }

    public boolean isOverviewControl() {
        return overviewControl;
    }

    public void setShadowImage(String param) {
        shadowImage = param;
    }

    public String getShadowImage() {
        return shadowImage;
    }

    public void setIconImage(String param) {
        iconImage = param;
    }

    public String getIconImage() {
        return iconImage;
    }

    public GeoMap() {
        $init$();
    }

    static String MAP;
    private String streetLine1;
    private String streetLine2;
    private String postalCode;
    private String state;
    private String city;
    private String country;
    private String shadowImage;
    private String iconImage;
    private Object object;
    private double latitude;
    private double longitude;
    private boolean hierarchicalTypeControl;
    private String mapControl;
    private boolean overviewControl;
    private boolean typeControl;
    private String model;
    private int scale;
    private String infoWindow;

    static {
        MAP = "Map";
        publish(GeoMap.class, MAP, "model");
        publish(GeoMap.class, MAP, "scale");
        publish(GeoMap.class, MAP, "country");
        publish(GeoMap.class, MAP, "state");
        publish(GeoMap.class, MAP, "city");
        publish(GeoMap.class, MAP, "postalCode");
        publish(GeoMap.class, MAP, "streetLine1");
        publish(GeoMap.class, MAP, "mapControl", 
                new OptionPropertyEditor("static:,None;Small,Small;Large,Large;"));
        publish(GeoMap.class, MAP, "typeControl");
        publish(GeoMap.class, MAP, "overviewControl");
        publish(GeoMap.class, MAP, "iconImage", new FilePropertyEditor());
        publish(GeoMap.class, MAP, "shadowImage", new FilePropertyEditor());
        publish(GeoMap.class, MAP, "infoWindow");
    }
}
